<!-- 新增数据页面 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- 引入web uploader 插件 -->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/webuploader/webuploader.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/webuploader/style.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/static/webuploader/webuploader.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/webuploader/upload.js"></script>
<!-- 引入web uploader 插件  End -->	
<script type="text/javascript">
$(function() {
	progressClose();
	
    $('#addForm').form({
        url : '${pageContext.request.contextPath}/info/pictures/add',
        onSubmit : function() {
            progressLoad();
            
            var picPath = $("#picPath").val();
            if(picPath==''){
            	progressClose();
            	$("#showPicPath").html('<font color="red">请先选择并上传图片！</font>');
            	return false;
            }
            
            var isValid = $(this).form('validate');
            if (!isValid) {
                progressClose();
            }
            return isValid;
        },
        success : function(result) {
            progressClose();
            result = $.parseJSON(result);
            if (result.success) {
            	parent.$.messager.alert('提示', result.msg, 'info');
                parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为list.jsp页面预定义好了
                parent.$.modalDialog.handler.dialog('close');
            } else {
                parent.$.messager.alert('错误', result.msg, 'error');
            }
        }
    });
});
</script>
<div class="easyui-layout" data-options="fit:true,border:false" >
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;" >
        <form id="addForm" method="post" >
            <table class="grid">
            	<tr>
		            <td>选择图片</td>
		            <td>
		            	<div id="uploader">
			                <div class="queueList">
			                    <div id="dndArea" class="placeholder">
			                        <div id="filePicker"></div>
			                        <p>或将照片拖到这里，单次最多可选1张</p>
			                    </div>
			                </div>
			                <div class="statusBar" style="display:none;">
			                    <div class="progress">
			                        <span class="text">0%</span>
			                        <span class="percentage"></span>
			                    </div><div class="info"></div>
			                    <div class="btns">
			                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
			                    </div>
			                </div>
			            </div>
		            </td>
		        </tr>
				<tr>
		            <td>标题</td>
		            <td><input name="title" type="text" placeholder="请输入标题" 
		            	class="easyui-validatebox" data-options="required:true" value=""></td>
		        </tr>
				<tr>
		            <td>文件名</td>
		            <td><input name="picName" type="text" placeholder="请输入文件名" 
		            	class="easyui-validatebox" data-options="required:true" value=""></td>
		        </tr>
				<tr>
		            <td>路径</td>
		            <td><input id="picPath" name="picPath" type="hidden" value="">
		            	<span id="showPicPath"></span>
		            </td>
		        </tr>
				<tr>
		            <td>备注</td>
		            <td><textarea name="remark" rows="" cols="" ></textarea></td>
		        </tr>
            </table>
        </form>
    </div>
</div>